package cn.mesmile.design.factory.simplefactory;

import cn.hutool.core.util.StrUtil;
import cn.mesmile.design.factory.AliPay;
import cn.mesmile.design.factory.Pay;
import cn.mesmile.design.factory.WechatPay;

/**
 * @author zb
 * @date 2020/11/15 12:01
 * @Description:
 */
public class SimpleFactory {

    /**
     *  简单工厂模式 【】
     */
    public static Pay createPay (String payType) {
        if (StrUtil.isEmpty(payType)) {
            return null;
        } else if (payType.equalsIgnoreCase("WECHAT_PAY")) {
            return new WechatPay();
        } else {
            return new AliPay();
        }

    }


}
